﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Ventas.Master" AutoEventWireup="true" CodeBehind="Empresa.aspx.cs" Inherits="Trade.WebForm5" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxNavBar" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
        .style1
        {
            width: 66px;
        }
        .style3
        {
            width: 185px;
        }
        </style>
    <style type="text/css">
/* -- ASPxNavBar Lite -- */
.dxnbLite_SoftOrange1 
{
	color: white;
	background-color: transparent;
	border: 4px Solid #D3D3D3;
	font: 12px Tahoma, Geneva, sans-serif;
    font-weight:bold;
	list-style: none none outside;
	margin: 0;
	padding: 1px;
	float: left;
	width: 99%;
}
.dxnbLite_SoftOrange1 .dxnb-content 
{
	color: #FFF;
	border-bottom: 1px Dotted #5C5C5C;
	list-style: none none outside;
	margin: 0;
	padding: 2px 1px;
	overflow: hidden;
}
.dxgvControl_Metropolis1,
.dxgvDisabled_Metropolis1
{
	border: 1px Solid #c0c0c0;
	font: 12px 'Segoe UI', Helvetica, 'Droid Sans', Tahoma, Geneva, sans-serif;
	background-color: #0e1452;
	color: #FFF;
	cursor: default;
}
.dxgvHeader_Metropolis1
{
	cursor: pointer;
	white-space: nowrap;
	padding: 4px 6px 5px;
	border: 1px Solid #FFF;
	overflow: hidden;
	font-weight: normal;
	text-align: left;
	background-color: #0e1452;
}
.dxgvTable_Metropolis1
{
	background-color: transparent;
	border-width: 0;
	border-collapse: separate!important;
	overflow: hidden;
}
.dxeBase_Metropolis1
{
	font: 12px 'Segoe UI', Helvetica, 'Droid Sans', Tahoma, Geneva, sans-serif;
	/* color: #333333; */
}
.dxeBase_Metropolis1
{
	font: 12px 'Segoe UI', Helvetica, 'Droid Sans', Tahoma, Geneva, sans-serif;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="frmEmpresa" style="position:absolute;height:auto;width:728px;margin-top:6px;display:inline-table;border:1px solid #EF7F01;vertical-align:middle;left:50%;margin-left:-364px;">
        <table style="width:100%">
            <tr>
                <td>
                    <dx:ASPxLabel ID="ASPxLabel1" runat="server" Font-Bold="true" ForeColor="White" Text="COMPANY" Font-Size="Medium"></dx:ASPxLabel>
                </td>
            </tr>
            <tr>
                <td>
                    <table style="width:30%">
                        <tr>
                            <td style="width:70px">
                                <dx:ASPxButton ID="btnNuevo" runat="server" Text="New" Theme="SoftOrange1" 
                                    onclick="btnNuevo_Click"></dx:ASPxButton>
                            </td>
                            <td style="width:70px">
                                <dx:ASPxButton ID="btnGrabar" runat="server" Text="Save" Theme="SoftOrange1" 
                                    onclick="btnGrabar_Click"></dx:ASPxButton>
                            </td>
                            <td style="width:70px">
                                <dx:ASPxButton ID="btnBorrar" runat="server" Text="Delete" Theme="SoftOrange1" 
                                    onclick="btnBorrar_Click">
                                </dx:ASPxButton>
                            </td>
                            <td style="width:70px">
                                <dx:ASPxButton ID="btnBuscar" runat="server" Text="Search" Theme="SoftOrange1" 
                                    onclick="btnBuscar_Click">
                                </dx:ASPxButton>
                            </td>
                        </tr>
                        <tr>
                            <td style="width:70px">
                                <dx:ASPxLabel ID="lblExitoso" runat="server" Text="Save Succefull" Visible="False" Font-Bold="True" ForeColor="Red">
                                </dx:ASPxLabel>
                            </td>
                            <td style="width:70px">
                                    <dx:ASPxLabel ID="lblError" runat="server" Text="Fatal Error" Visible="False" Font-Bold="True" ForeColor="Red">
                                    </dx:ASPxLabel>
                            </td>
                            <td colspan = "2">
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" HeaderText="MENSAJES DE ERROR" Height="60px" 
                                ValidationGroup="VE" Width="170px"/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="txtid" runat="server" Visible="false"></asp:TextBox>
                    <dx:ASPxNavBar ID="nvbEmpresa" runat="server" RenderMode="Lightweight" Width="98.5%" Theme="SoftOrange1">
                        <Groups>
                            <dx:NavBarGroup>
                                <HeaderTemplate> COMPANY DATA </HeaderTemplate>
                                <ContentTemplate>
                                    <table style="border-right:2px white solid;border-left:2px white solid;border-top:2px white solid;border-bottom:2px white solid;width:100%;">
                                            <tr style="font-size:12px;">
                                                <td>
                                                    <dx:ASPxLabel ID="lblName" runat="server" Text="Nombre Comercial:" Width="120" Theme="Metropolis1" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtNombreComercial" runat="server" Theme="Metropolis1" Width="170px"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                                        ControlToValidate="txtNombreComercial" ErrorMessage="*" 
                                                        ForeColor="Red" ValidationGroup="VE"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revCorreo0" runat="server" 
                                                        ControlToValidate="txtNombreComercial" ErrorMessage="Ingrese letras" 
                                                        ForeColor="Red" ValidationExpression="[aA-zZ ]*." ValidationGroup="VE"></asp:RegularExpressionValidator>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="lblEmail" runat="server" Text="Email Address:" Theme="Metropolis1" Width="100" ForeColor="White">
                                                    </dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtEmail" runat="server" Theme="Metropolis1" Width="170px"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" 
                                                        ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red" 
                                                        ValidationGroup="VE"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revCorreo" runat="server" 
                                                        ControlToValidate="txtEmail" ErrorMessage="Correo No Valido" ForeColor="Red" 
                                                        ValidationExpression="^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$" 
                                                        ValidationGroup="VE"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="lblContac" runat="server" Text="Contact Name:" Width="100" Theme="Metropolis1" ForeColor="White">
                                                        </dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtContactName" runat="server" Width="170px" Theme="Metropolis1">
                                                        </dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <asp:RegularExpressionValidator ID="revCorreo1" runat="server" 
                                                        ControlToValidate="txtContactName" ErrorMessage="Ingrese letras" 
                                                        ForeColor="Red" ValidationExpression="[aA-zZ ]*." ValidationGroup="VE"></asp:RegularExpressionValidator>
                                                    <br />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 
                                                        ControlToValidate="txtContactName" ErrorMessage="*" 
                                                        ForeColor="Red" ValidationGroup="VE"></asp:RequiredFieldValidator>  
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="lblWPage" runat="server" Text="Web Page:" Theme="Metropolis1" Visible="true" ForeColor="White">
                                                        </dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtWeb" runat="server" Width="170px" Theme="Metropolis1" Visible="True"></dx:ASPxTextBox>
                                                </td>
                                            </tr>
                                             <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="lblPhone" runat="server" Text="Phone(1) #:"  Width="100" Theme="Metropolis1" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtPhone" runat="server" Width="170px" Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" 
                                                        ControlToValidate="txtPhone" ErrorMessage="*" 
                                                        ForeColor="Red" ValidationGroup="VE"></asp:RequiredFieldValidator>
                                                    <asp:RangeValidator ID="RangeValidator3" runat="server" 
                                                        ControlToValidate="txtPhone" ErrorMessage="Escriba solo numeros" 
                                                        ForeColor="Red" MaximumValue="999999999999999" MinimumValue="0" 
                                                        ValidationGroup="VE"></asp:RangeValidator>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="lblFax" runat="server" Text="Fax #:" Width="100" Theme="Metropolis1" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtFax" runat="server" Width="170px" Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <asp:RangeValidator ID="RangeValidator4" runat="server" ForeColor="Red" 
                                                        MaximumValue="999999999999999" MinimumValue="0" 
                                                        ControlToValidate="txtFax" ValidationGroup="VE" 
                                                        ErrorMessage="Escriba solo Numeros"></asp:RangeValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="lblPhone2" runat="server" Text="Phone(2) #:"  Width="100" Theme="Metropolis1" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtPhone2" runat="server" Width="170px" Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <asp:RangeValidator ID="RangeValidator9" runat="server" 
                                                        ControlToValidate="txtPhone2" ErrorMessage="Escriba solo numeros" 
                                                        ForeColor="Red" MaximumValue="999999999999999" MinimumValue="0" 
                                                        ValidationGroup="VE"></asp:RangeValidator>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="lblmovil" runat="server" Text="Movil #:" Width="100" Theme="Metropolis1" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtMovil" runat="server" Width="170px" Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <asp:RangeValidator ID="RangeValidator10" runat="server"  ForeColor="Red" 
                                                        MaximumValue="999999999999999" MinimumValue="0" 
                                                        ControlToValidate="txtMovil" ValidationGroup="VE" 
                                                        ErrorMessage="Escriba solo Numeros"></asp:RangeValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="lblDescripcion" runat="server" Text="Description:"  Theme="Metropolis1" Width="100" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxMemo ID="txtDescripcion" runat="server" Height="71px"  Theme="Metropolis1" Width="170px">
                                                    </dx:ASPxMemo>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" 
                                                        ControlToValidate="txtDescripcion" ErrorMessage="*" 
                                                        ForeColor="Red" ValidationGroup="VE"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revCorreo2" runat="server" 
                                                        ControlToValidate="txtDescripcion" ErrorMessage="Ingrese letras" 
                                                        ForeColor="Red" ValidationExpression="[aA-zZ ]*." ValidationGroup="VE"></asp:RegularExpressionValidator>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="lblObservacion" runat="server" Text="Comments:" Width="100" Theme="Metropolis1" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxMemo ID="txtObservacion" runat="server" Height="71px" Theme="Metropolis1" Width="170px"></dx:ASPxMemo>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server" 
                                                        ControlToValidate="txtObservacion" ErrorMessage="*" 
                                                        ForeColor="Red" ValidationGroup="VE"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revCorreo3" runat="server" 
                                                        ControlToValidate="txtObservacion" ErrorMessage="Ingrese letras" 
                                                        ForeColor="Red" ValidationExpression="[aA-zZ ]*." ValidationGroup="VE"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                        </table>
                                </ContentTemplate>
                            </dx:NavBarGroup>
                            <dx:NavBarGroup Expanded="True">
                                <HeaderTemplate> LOCATION </HeaderTemplate>
                                <ContentTemplate>
                                    <table style="border-right:2px white solid;border-left:2px white solid;border-top:2px white solid;border-bottom:2px white solid;width:100%;">
                                            <tr style="font-size:12px;">
                                                <td class="style1">
                                                    <dx:ASPxLabel ID="lblCountry" runat="server" Text="Country:" Theme="Metropolis1" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td class="style3">
                                                    <dx:ASPxComboBox ID="ASPxComboBox1" runat="server" Theme="Metropolis1" 
                                                        DataSourceID="Source_Pais" TextField = "PaisNombre" 
                                                        ValueField ="PaisCodigo" Height="16px" Width="300px" 
                                                        onselectedindexchanged="ASPxComboBox1_SelectedIndexChanged" 
                                                        ontextchanged="ASPxComboBox1_TextChanged" 
                                                        onvaluechanged="ASPxComboBox1_ValueChanged">
                                                    </dx:ASPxComboBox>
                                                    
                                                    <asp:EntityDataSource ID="Source_Pais" runat="server" 
                                                        ConnectionString="name=General_Entities" 
                                                        DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                        EntitySetName="Pais" EntityTypeFilter="Pais" GroupBy="" 
                                                        Select="it.[PaisCodigo], it.[PaisNombre]">
                                                    </asp:EntityDataSource>
                                                </td>

                                                <td>
                                                    <dx:ASPxLabel ID="lblCity" runat="server" Text="City:" Theme="Metropolis1" ForeColor="White"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxComboBox ID="ASPxComboBox2" runat="server" Theme="Metropolis1" 
                                                        DataSourceID="Source_Ciudad" TextField = "CiudadNombre" 
                                                        ValueField= "CiudadID" Height="16px" Width="300px"> 
                                                    </dx:ASPxComboBox>
                                                    
                                                    <asp:EntityDataSource ID="Source_Ciudad" runat="server" 
                                                        ConnectionString="name=General_Entities" 
                                                        DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                        EntitySetName="Ciudad" EntityTypeFilter="Ciudad" 
                                                        Select="it.[CiudadID], it.[CiudadNombre]" GroupBy="">
                                                    </asp:EntityDataSource>
                                                    
                                                </td>
                                            </tr>
                                            <tr><td></td></tr>
                                             <tr>
                                                <td class="style1">
                                                    <dx:ASPxLabel ID="lblAddress" runat="server" Text="Address(1):" Theme="Metropolis1" ForeColor="White">
                                                    </dx:ASPxLabel>
                                                </td>
                                                <td  colspan="3">
                                                    <dx:ASPxTextBox ID="txtAddress" runat="server" Width="650px" Theme="Metropolis1" >
                                                    </dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                                        ControlToValidate="txtAddress" ErrorMessage="*" ForeColor="Red" 
                                                        ValidationGroup="VE"></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr><td></td></tr>
                                            <tr>
                                            <td class="style1">
                                                <dx:ASPxLabel ID="lblAdress2" runat="server" Text="Address(2):" Theme="Metropolis1" ForeColor="White">
                                                </dx:ASPxLabel>
                                            </td>
                                            <td  colspan="3">
                                                <dx:ASPxTextBox ID="txtAddress2" runat="server" Width="650px" Theme="Metropolis1">
                                                </dx:ASPxTextBox>
                                            </td>
                                            </tr>
                                        </table>
                                </ContentTemplate>
                            </dx:NavBarGroup>
                            <dx:NavBarGroup Visible ="false">
                                <HeaderTemplate> REGISTRATIONS & CERTIFICATIONS </HeaderTemplate>
                                <ContentTemplate>
                                    <table style="border-right:2px white solid;border-left:2px white solid;border-top:2px white solid;border-bottom:2px white solid;width:100%;">
                                           <tr style="font-size:12px;">
                                                <td class="style3">
                                                    <dx:ASPxCheckBox ID="chbFDA" runat="server" Text="FDA"></dx:ASPxCheckBox>
                                                    <dx:ASPxTextBox ID="txtNumberFDA" runat="server" Width="170px" Theme="Metropolis1" Visible="false"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxCheckBox ID="chbEU" runat="server" Text="EU"></dx:ASPxCheckBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxCheckBox ID="chbAsia" runat="server" Text="ASIA"></dx:ASPxCheckBox>
                                                </td>
                                            </tr>
                                            <tr style="font-size:12px;">
                                                <td class="style3">
                                                    <dx:ASPxCheckBox ID="chbBAP" runat="server" Text="BAP"></dx:ASPxCheckBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxCheckBox ID="ASPxCheckBox2" runat="server" Text="BAP"></dx:ASPxCheckBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxCheckBox ID="ASPxCheckBox3" runat="server" Text="BAP"></dx:ASPxCheckBox>
                                                </td>
                                            </tr>
                                        </table>
                                </ContentTemplate>
                            </dx:NavBarGroup>
                        </Groups>
                    </dx:ASPxNavBar>
                </td>
                     <td>
                        <dx:ASPxPopupControl ID="Pop_Empresas" runat="server" RenderMode="Lightweight"
                        HeaderText="Choose a Company" Modal="true" PopupHorizontalAlign="WindowCenter"
                        PopupVerticalAlign="WindowCenter" Theme="SoftOrange1" EnableTheming="true">
                            <ContentCollection>
                                <dx:PopupControlContentControl>
                                     <div id="recuadro_inicio" style="width:450px;margin-left:auto;margin-right:auto;margin-top:10px;overflow:hidden;height:auto;background-color:#FFF;border:2px solid #B74900;">
                                         <dx:ASPxGridView ID="dtg_Empresa" runat="server" Theme="SoftOrange1" AutoGenerateColumns="false" 
                                                            KeyFieldName="codigo"  DataSourceID="Source_Empresa">
                                             <ClientSideEvents RowDblClick="function(s, e) {
                                                                                              var key = s.GetRowKey(e.visibleIndex);
                                                                                              window.location.href='Empresa.aspx?prov='+key;
                                                                                            }" />
                                             <Columns>
                                                 <dx:GridViewDataTextColumn Caption="codigo" FieldName="codigo" Visible="false" VisibleIndex="0" ></dx:GridViewDataTextColumn>
                                                 <dx:GridViewDataTextColumn Caption="Name" FieldName="nombre" VisibleIndex="1"></dx:GridViewDataTextColumn>
                                                 <dx:GridViewDataTextColumn Caption="Contact" FieldName="contacto" VisibleIndex="2"></dx:GridViewDataTextColumn>
                                                 <dx:GridViewDataTextColumn Caption="estado" FieldName="estado" Visible="false" VisibleIndex="3"></dx:GridViewDataTextColumn>
                                             </Columns>
                                             <SettingsBehavior AllowFocusedRow="true"/>
                                             <Settings ShowFilterRow="True" />
                                         </dx:ASPxGridView>
                                         
                                         <asp:SqlDataSource ID="Source_Empresa" runat="server" 
                                             ConnectionString="<%$ ConnectionStrings:prod_001ConnectionString %>" 
                                             SelectCommand="consultar.PA_Consultar_Empresa_X_Usuario" 
                                             SelectCommandType="StoredProcedure">
                                             <SelectParameters>
                                                 <asp:SessionParameter DefaultValue="" Name="cod_usuario" SessionField="CodigoUsuario" Type="Decimal" />
                                             </SelectParameters>
                                         </asp:SqlDataSource>
                                         
                                    </div>
                                </dx:PopupControlContentControl>
                            </ContentCollection>
                        </dx:ASPxPopupControl>
                    </td>
            </tr>
        </table>

    </div>
    <script>
        function Prueba() {
                alert("s");
                $.ajax({
                    url: 'Empresa.aspx/combo',
                    dataType: "POST",
                    cache: false,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    async: true,

                    data: {
                        e: "red"
                    }
                }).done(function (data) {
                    if (data) {
                    }
                });

        }
    </script>
</asp:Content>
